import request from './request'

export const getCity = () => {
  return request({
    url: '/v3/ip',
    method: 'GET',
    params: {
      key: '79d0365438232fd06e634559aa47bd3f'
    }
  })
}

export const getAdcode = city => {
  return request({
    url: '/v3/geocode/geo',
    method: 'GET',
    params: {
      key: '79d0365438232fd06e634559aa47bd3f',
      address: city
    }
  })
}

export const getLives = adcode => {
  return request({
    url: '/v3/weather/weatherInfo',
    method: 'GET',
    params: {
      key: '79d0365438232fd06e634559aa47bd3f',
      city: adcode,
      extensions: 'base'
    }
  })
}

export const getForecasts = adcode => {
  return request({
    url: '/v3/weather/weatherInfo',
    method: 'GET',
    params: {
      key: '79d0365438232fd06e634559aa47bd3f',
      city: adcode,
      extensions: 'all'
    }
  })
}
